import {JPushTokenUpdateRequest} from "@/types/notification/jiguang-push-token";
import api from "@/services/api/init";
import {AxiosResponse} from "axios";
import {Result} from "@/types/api-common";


/**
 * 设置极光推送令牌
 * @param registerId 极光推送注册ID
 * @returns Promise<void>
 */
export async function setJPushToken({registerId}: JPushTokenUpdateRequest): Promise<AxiosResponse<Result<void>>> {
    return await api.post("/jpushtoken", {registerId})
}

/**
 * 检查极光推送令牌是否设置成功
 * @returns Promise<boolean>
 */
export async function checkJPushToken(): Promise<AxiosResponse<Result<boolean>>> {
    return await api.get("/jpushtoken/check");
}